package android.demo.download;

public class SPIError {
	
	private String errorCode = null;
	private String errorDescription = null;
	
	public SPIError() {
		super();
	}

	public SPIError(String networkErrorCode, String networkErrorDescription) {
		super();
		this.errorCode = networkErrorCode;
		this.errorDescription = networkErrorDescription;
	}

	public String getErrorCode() {
		return errorCode;
	}
	
	public String getErrorDescription() {
		return errorDescription;
	}

	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}

	public void setErrorDescription(String errorDescription) {
		this.errorDescription = errorDescription;
	}
	
	public static SPIError genNetworkError(int errorCode){
		SPIError error = new SPIError();
		String description = "";
		switch (errorCode) {
			case 204:
				description = "Error 204: No content";
				break;
			case 403:
				description = "Error 403: Forbidden";
				break;
			case 404:
				description = "Error 404: Not found";
				break;
			default:
				break;
		}
		error.setErrorCode(String.valueOf(errorCode));
		error.setErrorDescription(description);
		return error;
	}
	
}
